package com.rd.student.jiaji.class3.qinjialin.day0731;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;

public class Question {


    public static void main(String[] args) {
        List<Integer> b = new ArrayList();
        for (int n = 0; n < 21; n++) {
            b.add(n);
        }
        // Answer1(b);
        // Answer2();
        // Answer3();

    }

    public static void Answer1(List b) {
        Collections.shuffle(b);
        for (int i = 0; i <= 20; i++) {
            System.out.print("  " + b.get(i));
        }
    }

    public static void Answer2() {
        List<Integer> c = new ArrayList<>();
        for (int i = 0; i < 21; i++) {
            int random = (int) (Math.random() * 50);
            if (c.contains(random)) {
                i--;
                continue;
            }
            c.add(random);
            System.out.print("  " + c.get(i));
        }
    }

    public static void Answer3() {
        HashSet<Integer> c = new HashSet<>(20);
        while (c.size() != 20) {
            int random = (int) (Math.random() * 50);
            c.add(random);
        }
        System.out.println(c);
        for (Integer cc : c) {
            System.out.print(" " + cc);

        }
    }
}


